import request from '/@/utils/http/axios';
import { LoginParams, refreshTokenParams, GetUserInfoModel } from './model/userModel';

/**
 *  @description 发送验证码
 */
export const sendValidate = (mobile: string | number, event: string) => {
  return request.get({
    url: '/ytx-cloud-public/v200/common/Sms/send',
    params: { mobile, event }
  });
};

export const registe = (params: any) => {
  return request.post({
    url: '/ytx-cloud-user/v200/user/agent/inviteRegister',
    params
  });
};

/**
 *  @description 登录
 */

export const login = (params: LoginParams) => {
  return request.post({ url: '/api/audit-auth/declare/oauth/token', params });
};

/**
 *  @description 刷新token
 */
export const refreshToken = (params: refreshTokenParams) => {
  return request.post({ url: '/api/audit-auth/declare/oauth/token', params });
};

/**
 * @description: 获取用户信息
 */
export function getUserInfo() {
  return request.get<GetUserInfoModel>({ url: '' });
}
